package cn.achao.csr.api.factory;


import cn.achao.csr.api.SysOperationLogApi;
import cn.achao.csr.api.model.dto.OperaAddDTO;
import cn.achao.csr.base.resp.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: achao
 **/
@Slf4j
@Component
public class SysOperationLogFallbackFactory implements FallbackFactory<SysOperationLogApi> {


    @Override
    public SysOperationLogApi create(Throwable throwable) {
        return new SysOperationLogApi() {
            @Override
            public R<?> add(OperaAddDTO req, String source) {
                return R.fail("保存操作日志失败:" + throwable.getMessage());
            }


        };
    }

}
